package com.fau.wm.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;
import org.json.simple.JSONAware;
import org.json.simple.JSONObject;

/**
 * @desc 订单系统——产品销售统计
 * @author kangyj
 * @datetime 2014年12月10日,下午9:39:29
 */
@Entity
@Table(name = "medical_orders_pro_sta")
public class MedicalOrdersProSta implements Serializable, JSONAware {

	private static final long serialVersionUID = -1214657628799236285L;
	
	private String id;
	private String productId;		// 订单产品id
	private String productName;		// 产品名称
	private String ordersCount;		// 订单数
	private Integer orderingCount;	// 订货数
	private BigDecimal orderingPrice;	// 订货额
	private BigDecimal freight;			// 运费
	private Date ordersTime;			// 下单时间
	private String cusSerId;			// 客服id
	private String groupId;				// 下单组id
	private String mediaId;				// 媒体id
	private String startTime;			// 开始时间
	private String endTime;				// 结束时间
	private BigDecimal totalMoney;		// 总金额
	private String hospitalId;			// 医院id
	
	private Date stime;
	private Date etime;

	@Id
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@GeneratedValue(generator = "generator")
	@Column(name = "id", length = 32)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "product_id", length = 32)
	public String getProductId() {
		return productId;
	}

	public void setProductId(String productId) {
		this.productId = productId;
	}

	@Column(name = "product_name", length = 50)
	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}
	
	@Transient
	public String getOrdersCount() {
		return ordersCount;
	}

	public void setOrdersCount(String ordersCount) {
		this.ordersCount = ordersCount;
	}

	@Column(name = "ordering_count", length = 11)
	public Integer getOrderingCount() {
		return orderingCount;
	}

	public void setOrderingCount(Integer orderingCount) {
		this.orderingCount = orderingCount;
	}

	@Column(name = "ordering_price", length = 11)
	public BigDecimal getOrderingPrice() {
		return orderingPrice;
	}

	public void setOrderingPrice(BigDecimal orderingPrice) {
		this.orderingPrice = orderingPrice;
	}

	@Column(name = "freight", length = 11)
	public BigDecimal getFreight() {
		return freight;
	}

	public void setFreight(BigDecimal freight) {
		this.freight = freight;
	}

	@Column(name = "orders_time")
	public Date getOrdersTime() {
		return ordersTime;
	}

	public void setOrdersTime(Date ordersTime) {
		this.ordersTime = ordersTime;
	}

	@Column(name = "cus_ser_id", length = 32)
	public String getCusSerId() {
		return cusSerId;
	}

	public void setCusSerId(String cusSerId) {
		this.cusSerId = cusSerId;
	}

	@Column(name = "group_id", length = 32)
	public String getGroupId() {
		return groupId;
	}

	public void setGroupId(String groupId) {
		this.groupId = groupId;
	}

	@Column(name = "media_id", length = 32)
	public String getMediaId() {
		return mediaId;
	}

	public void setMediaId(String mediaId) {
		this.mediaId = mediaId;
	}
	
	@Transient
	public String getStartTime() {
		return startTime;
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	@Transient
	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}
	
	@Transient
	public BigDecimal getTotalMoney() {
		return totalMoney;
	}

	public void setTotalMoney(BigDecimal totalMoney) {
		this.totalMoney = totalMoney;
	}

	@Column(name = "hospital_id", length = 32)
	public String getHospitalId() {
		return hospitalId;
	}

	public void setHospitalId(String hospitalId) {
		this.hospitalId = hospitalId;
	}

	@Transient
	public Date getStime() {
		return stime;
	}

	public void setStime(Date stime) {
		this.stime = stime;
	}

	@Transient
	public Date getEtime() {
		return etime;
	}

	public void setEtime(Date etime) {
		this.etime = etime;
	}

	@SuppressWarnings("unchecked")
	@Override
	public String toJSONString() {
		JSONObject obj = new JSONObject();
		obj.put("productName", productName);
		obj.put("ordersCount", ordersCount);
		obj.put("orderingCount", orderingCount);
		obj.put("orderingPrice", orderingPrice);
		obj.put("freight", freight);
		obj.put("totalMoney", totalMoney);
		return obj.toString();
	}

}
